package com.jgp.security.controller;

import com.jgp.security.pojo.RoleMenuRequestParam;
import com.jgp.security.service.SecRoleMenuService;
import com.jgp.sys.controller.JGPBackController;
import com.jgp.sys.ui.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 项目   jgp-cloud-parent
 * 作者   loufei
 * 时间   2019-11-03
 */
@RestController
@RequestMapping("/security/role-menu-api-ctl")
public class RoleMenuApiController extends JGPBackController {
    
    @Autowired
    private SecRoleMenuService service;
    
    @RequestMapping("modify-role-menu")
    public Result modifyRoleMenu(@RequestBody RoleMenuRequestParam param){
        service.modifyRoleMenu(param.getRoleId(),param.getMenuIds());
        return ajaxRe(true);
    }
    
    @RequestMapping("query-menu")
    public Result queryMenu(Long roleId){
        return ajaxReData("menus",service.queryMenuIds(roleId));
    }
}
